<!DOCTYPE html>
<html>
<head>
   <title>CSS Animations - CSSStyleDeclaration DOM attributes</title>
   <link rel="author" title="Opera Software ASA" href="http://www.opera.com/">
   <link rel="help" href="http://dev.w3.org/csswg/css3-animations/#the-animation-name-property-">
   <meta name="flags" content="dom">
   <!--
   **************************************************************************
   ISSUE: These should be specified somewhere
   **************************************************************************
   -->
   <meta name="assert" content="The animation properties can be accessed via
   attributes on the CSSStyleDeclaration interface">
   <script src="/resources/testharness.js"></script>
   <script src="/resources/testharnessreport.js"></script>
   <style type="text/css">
      @keyframes grow {
         from {
            width: 100px;
         }
         to {
            width: 200px;
         }
      }
      div {
         width: 100px;
         height: 100px;
         background: blue;
      }
   </style>
   <script type="text/javascript">
      setup({explicit_done:true});
      onload = function() {
         var testName = document.querySelector('title').firstChild.data;
         var div = document.querySelector('div');
         var log = document.querySelectorAll('p')[1].firstChild;
         var passed = false;
         function report() {
            clearTimeout(timeout);
            test(function(){assert_true(passed);}, testName);
            done();
            log.data = (passed ? 'PASS if the animation occurred.' : 'FAIL');
         }
         var timeout = setTimeout(report, 1500);
         div.addEventListener('animationend', function(evt) {
            var style = getComputedStyle(div, null);
            passed = (style.width == '200px' && style.animationName == 'grow'
                      && style.animationDuration == '1s'
                      && style.animationDelay == '0s');
            report();
         });
         div.style.animation = 'grow 1s forwards';
      }
   </script>
   <style>iframe{display:none}</style>
</head>
<body>
   <p>The block below should grow in width for one second.</p>
   <p>Testing...</p>
   <div></div>
</body>
</html>
